local fk__taikang_other = fk.CreateSkill {

  name = "fk__taikang_other&",

  tags = {  },

}

local U = require "packages/utility/utility"


fk__taikang_other:addEffect("active", {
  name = "fk__taikang_other&",
  mute = true,
  card_num = 1,
  target_num = 1,
  prompt = "#fk__taikang-prompt",
  can_use = function(self, player)
    return player:usedSkillTimes(fk__taikang_other.name, Player.HistoryPhase) == 0
  end,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0
  end,
  target_filter = function(self, player, to_select, selected,cards)
    if #selected == 0 and to_select ~= player and #cards == 1 then
      local to = to_select
      return to:hasSkill("fk__taikang") and not to:isNude()
    end
  end,
  on_use = function(self, room, effect)
    local player =effect.from
    local to =effect.tos[1]
    to:broadcastSkillInvoke("fk__taikang")
    room:notifySkillInvoked(to, "fk__taikang", "drawcard")
    room:doIndicate(player.id, {to.id})
    room:recastCard(effect.cards, player, "fk__taikang")
    if to.dead or to:isNude() then return end
    local cards = room:askForCard(to, 1, 1, true, "fk__taikang", false, ".", "#fk__taikang-card")
    room:recastCard(cards, to, "fk__taikang")
    if to.dead or to:isNude() or player.dead then return end
    if #room:askForDiscard(to, 1, 1, true, "fk__taikang", true, ".", "#fk__taikang-cost:"..player.id) > 0 and not player.dead then
      room:setPlayerMark(player, "@@fk__taikang-turn", 1)
    end
  end,
})

return fk__taikang_other